<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    function* fn() {
        yield 11;
        yield 22;
    }
    var qs = fn()
    console.log(qs.next())
    // 每next()一次就执行一段“yield”

    for (var v of fn()) {
        console.log(v)
    }
    // 循环fn()不需要再一次一次调用
</script>

</html>